package com.source.lightfowl.basedata.entity;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.hibernate.annotations.CreationTimestamp;
import org.hibernate.annotations.GenericGenerator;
import org.springframework.format.annotation.DateTimeFormat;

import javax.persistence.*;
import java.util.Date;

@Entity
@Data
@Table(name = "barcode_machine_status")
public class Barcode_Machine_Status {
    @Id
    @GenericGenerator(name = "Barcode_Machine_Status-uuid", strategy = "uuid")
    @GeneratedValue(generator = "Barcode_Machine_Status-uuid")
    private String id;
    private String barcodeMachineId;
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @JsonFormat(shape = JsonFormat.Shape.STRING,pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT-8")
    private Date loginDate;
    private String state;  //多个状态
    private Integer barcodeSurplus;
    private Integer threshold;
    private String userId;
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @JsonFormat(shape = JsonFormat.Shape.STRING,pattern = "yyyy-MM-dd",timezone = "GMT-8")
    private Date offlineTime;
    private String createBy;
    @Temporal(TemporalType.TIMESTAMP)
    @CreationTimestamp
    @Column(nullable=false,updatable = false)
    @JsonFormat(shape = JsonFormat.Shape.STRING,pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT-8")
    private Date createDate;

    public Barcode_Machine_Status() {
    }

    public Barcode_Machine_Status(String barcodeMachineId,String state, String userId) {
        this.barcodeMachineId = barcodeMachineId;
        this.state = state;
        this.userId = userId;
    }

    //10月中旬  添加冗余字段返回前端  不出现在数据库
    @Transient
    private String stallsName; //档口名
    @Transient
    private String linkman; //联系人
    @Transient
    private String phome; //联系方式
    @Transient
    private String userName; //用户名
}
